<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title><%= htmlWebpackPlugin.options.title %></title>
    <script type="text/javascript">
      /**
       * 一个虚假的支持electron的nodejs环境的js
       * 兼容electron和普通vue网页应用
       */
      if (!window.require) {
          window.require = function (module) {
            window.console.log('%c [信息]require模块: ' + module, 'color:#5094d5')
            if (module === 'events') {
              const EventEmitter = class {
                // 绑定事件
                on (opt, fun) {}
                emit (opt, fun) {}
              }
              return EventEmitter
            } else if (module === 'url') {
              return {
                parse (url) {
                  // window.console.log('%c [信息]parse: ', 'color:#d56f50', url)
                  let host = url.substr(url.indexOf('://') + 3)
                  host = host.substr(0, host.indexOf('?'))
                  const hostname = host.substr(0, host.indexOf(':'))
                  const Url = new class {
                    auth = ''
                    query = url.substr(url.indexOf('?') + 1, url.length)
                    hostname = hostname
                    port = host.substr(host.indexOf(":") + 1, host.length)
                    protocol =  url.substr(0, url.indexOf('://') + 1)
                  }
                  window.console.log('%c [信息]parse: ', 'color:#d56f50', url, Url)
                  return Url
                },
                format (data) {
                  const url = data.protocol + '//' + data.hostname + ':' + data.port + '' + data.pathname
                  window.console.log('%c [信息]format: ', 'color:#d56f50', data, url)
                  return url
                }
              }
            } else if (module === './enhanceError') {
                return new Promise(function (resolve, reject) {
                    resolve()
                })
            }
            return {}
          }
        }
    </script>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html>
